<?php

class App_Helper_TopMenuItem {
   
   public $name;
   public $link;
   public $controller;
   public $action;
   public $title;   
   
   public function __construct($name, $title, $link, $module, $controller, $action) {
      $this->name = $name;
      $this->title = $title;
      $this->link = $link;
      $this->controller = $controller;
      $this->action = $action;
      $this->module = $module;
   }
   
   public function __toString() {
      $controller = Zend_Controller_Front::getInstance()->getRequest()->getParam('controller');
      $action = Zend_Controller_Front::getInstance()->getRequest()->getParam('action');
      $module = Zend_Controller_Front::getInstance()->getRequest()->getParam('module');
      return sprintf('<li><a href="%s"%s><span>%s</span></a></li>', $this->link, 
         ($this->module == $module && $this->controller == $controller && $this->action == $action ? ' class="active"' : ''), $this->title).PHP_EOL;
   }

}